# 引入模块
from urllib import request
from urllib import parse

data_str = parse.urlencode({
    "name": "qiku",
    "address": "东三街"
})
url = f"http://httpbin.org/get?{data_str}"
print(f"请求的url",url)

# 构建请求对象
req = request.Request(url, headers={
    'user-agent': "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
})

print("请求头",req.headers)

print("==="*55)
res = request.urlopen(req)
print("响应头",res.headers)
print("响应结果",res.read().decode())







